package com.example.mulittenantdemo.controller;


import com.example.mulittenantdemo.domain.AppVersion;
import com.example.mulittenantdemo.service.AppVersionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/app")
@Validated
public class AppController {
    @Autowired
    private AppVersionService appVersionService;

    @GetMapping("/get/{id}")
    public AppVersion sayHello(@PathVariable("id") Long id) {
        AppVersion byId = appVersionService.queryById(id);
        System.out.println(byId);
        return byId;
    }
    @GetMapping("/get1/{id}")
    public AppVersion sayHello1(@PathVariable("id") Long id) {
        AppVersion byId = appVersionService.queryById1(id);
        System.out.println(byId);
        return byId;
    }

    @GetMapping("/get2/{id}")
    public AppVersion sayHello2(@PathVariable("id") Long id) {
        AppVersion byId = appVersionService.queryById2(id);
        System.out.println(byId);
        return (byId);
    }

    @GetMapping("/get3/{id}/{code}")
    public AppVersion sayHello3(@PathVariable("id") Long id,@PathVariable("code") String code) {
        AppVersion byId = appVersionService.queryById3(id,code);
        System.out.println(byId);
        return (byId);
    }



    @GetMapping("/get4/{id}")
    public AppVersion sayHello4(@PathVariable("id") Long id) {
        AppVersion byId = appVersionService.queryById4(id);
        System.out.println(byId);
        return (byId);
    }
}
